//获取应用实例
let app = getApp();
let httptool=require("../../../utils/zry.httptool.js");
Page({
  data: {
      customer:{},
      msgprop:'',//消息提示 
  },
  //编辑点击事件
  editInfo: function() {
    wx.navigateTo({
      url: '../editInfo/editInfo'
    })
  },
  onLoad: function () {
    let that=this;
    let customerId= app.getStorage('customerId');
    let customer={};
    httptool.ajaxPost("/api/Customer/GetMyPageInfo", { UserId: customerId},function(res){
        if(res.suc){
          let data = app.notNull(res.data, []);
          // customer.provinceName=data.ProvinceName;
          // customer.cityName=data.CityName;
          // customer.Sex=data.Sex;
          // customer.Age=data.Age;
          // customer.Imgs=data.Imgs;
          // customer.ImgList=data.ImgList;
          // customer.Marriage=data.Marriage;
          // customer.Education=data.Education;
          // customer.Height=data.Height;
          // customer.Weight=data.Weight;
          // customer.wxQRCode=data.WXQRCode;
          // customer.Description=data.Description;
          // customer.CustomerName = app.getStorage('customerName');
          // customer.HeadImg = app.getStorage('headImg');
          /*存数据*/
          // app.setStorage("Sex", data.Sex);
          // app.setStorage("Height", data.Height);
          // app.setStorage("weight", data.Weight);
          // app.setStorage("Education", data.Education);
          // app.setStorage("ProvinceName", data.ProvinceName);
          // app.setStorage("CityName", data.CityName);
          that.setData({customer:data});
        }else{
             app.showNotify(that, res.msg);
        }
         
     });

  },
  previewImg:function(e){//预览图片
    let that=this;
    let url=[];
    url.push(that.data.customer.WXQRCode);
    let imgtype=e.currentTarget.dataset.imgtype;//预览图片类型
      //图片预览
    if(imgtype==1){//图片列表
      let src = e.currentTarget.dataset.src;//获取data-src
      let imgLists = e.currentTarget.dataset.list;//获取data-list
      wx.previewImage({
        current: src, // 当前显示图片的http链接
        urls: imgLists // 需要预览的图片http链接列表
      })
    }else{
       wx.previewImage({
        current: that.data.customer.WXQRCode, // 当前显示图片的http链接
        urls: url // 需要预览的图片http链接列表
      })
    }

  },
})
